package pers.john.fsmanager.command;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;

import pers.john.fsmanager.core.FileManager;

public class CopyCommand extends AbstractCommand{
	private String source;
	private String target;
	public CopyCommand(OutputStream out, FileManager fileManager) {
		super(out, fileManager);
	}
	
	public void setSource(String source) {
		this.source = source;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	@Override
	public void commandProcess() {
		try {
			fileManager.copy(source, target);
		} catch (FileNotFoundException e) {
			try {
				out.write("源文件找不到".getBytes());
			} catch (IOException e1) {
				e1.printStackTrace();
			}
		}
	}
}
